package student_System;

public class student {
    //JavaBean类
    //学生类
    //属性：id、姓名、年龄、家庭住址
    //id
    private String id;
    //姓名
    private String name;
    //年龄
    private int age;
    //家庭住址
    private String dz;



    //空参
    public student() {}
    //全参
    public student(String id, String name, int age, String dz) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.dz = dz;
    }

    //获取的函数

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age>0) {
            this.age = age;
        } else if (age>120) {
            System.out.println("年龄不能那么大！！");
        }else {
            System.out.println("年龄不能小于零");
        }
    }

    public String getDz() {
        return dz;
    }

    public void setDz(String dz) {
        this.dz = dz;
    }
}
